import { ShaohuoContentService } from 'services/Api'
import store from 'store'

export const tableConfig = {
  colunms: [
    {
      label: '运单号\n捎货类型\n订单状态\n订单归属地',
      prop: [ 'order_num', 'func_name', 'status', 'start_addr' ]
    }, {
      label: '商品信息',
      prop: 'item_name',
      sortable: true,
      isAudio: 'is_audio'
    }, {
      label: '是否指派捎货人',
      prop: 'shname',
      sortable: true
    }, {
      label: '下单人\n电话\n下单时间\n预约达到时间',
      prop: [ 'nick_name', 'mobile', 'create_time', 'book_time' ]
    }, {
      label: '当前接单捎货人\n接单人电话\n接单时间',
      prop: [ 'guishu.nick_name', 'guishu.mobile', 'guishu.create_time' ]
    }, {
      label: '下单金额\n加价金额',
      prop: [ 'goods_price', 'shipping_fee' ]
    }, {
      label: '收件人\n电话\n收件地址\n送达时间',
      prop: [ 'shoujian.consignee', 'shoujian.mobile', 'shoujian.address', 'shoujian.time' ]
    }
  ]
}

export const searchConfig = [
  {
    name: '模糊查询',
    key: 'search',
    type: 'input',
    placeholder: '请填写查询关键词',
    value: '',
    isCanCommonSearch: true
  }, {
    name: '捎货类型',
    key: 'orderType',
    type: 'select',
    placeholder: '选择捎货类型',
    asyncItems: {
      getAsyncItems: () => {
        return ShaohuoContentService.shaohuoType({ acc_id: store.state.acc_id })
      },
      asyncItemsHandler: res => {
        return res.map(i => {
          return { label: i.name, value: i.id }
        })
      }
    },
    value: '',
    isCanCommonSearch: true
  }, {
    name: '订单归属地(区)',
    key: 'district',
    type: 'area',
    value: ''
  }, {
    name: '订单状态',
    key: 'orderStatus',
    type: 'select',
    placeholder: '选择订单状态',
    items: [
      { label: '待付款', value: '1' },
      { label: '待应答(已付款)', value: '2' },
      { label: '待取件', value: '3' },
      { label: '待收件', value: '4' },
      { label: '待确认', value: '5' },
      { label: '已完成', value: '6' },
      { label: '已取消', value: '7' }
    ],
    value: '',
    isCanCommonSearch: true
  }, {
    name: '是否指派捎货人',
    key: 'isShipping',
    type: 'select',
    placeholder: '选择是否指派',
    items: [
      { label: '有指派', value: '1' },
      { label: '未指派', value: '0' }
    ],
    value: '',
    isCanCommonSearch: true
  }, {
    name: '下单时间',
    key: [ 'orderStime', 'orderEtime' ],
    placeholder: '选择下单时间',
    type: 'datetimerange',
    value: []
  }, {
    name: '预计送达时间',
    key: [ 'preSendStime', 'preSendEtime' ],
    placeholder: '选择预计送达时间',
    type: 'datetimerange',
    value: []
  }, {
    name: '接单时间',
    key: [ 'receiveStime', 'receiveEtime' ],
    placeholder: '选择接单时间',
    type: 'datetimerange',
    value: []
  }, {
    name: '送达时间',
    key: [ 'sendStime', 'sendEtime' ],
    placeholder: '选择送达时间',
    type: 'datetimerange',
    value: []
  }
]
